<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <p title="hello!" class="p">今天天气不错</p>
    <a href="http://www.baidu.com" target="_blank" class="link-bf">百度</a>
    <button class="btn1">移除a的title属性</button>
    <script>
        var pEl = document.getElementsByClassName('p')[0];
        // 取属性值
        var titleValue = pEl.getAttribute('title');
        var classValue = pEl.getAttribute('class');
        console.log(titleValue);
        console.log(pEl.title);
        console.log(classValue);
        console.log(pEl.className);
        // 设置值
        var aEl = document.getElementsByClassName('link-bf')[0];
        aEl.setAttribute('tilte', '不凡学院');
        aEl.href = 'http://www.bufanui.com';
        // 删除值
        // aEl.removeAttribute('tltle');
    </script>
</body>
</html>